/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package plugins.lcdstation;

import gnu.io.NoSuchPortException;
import gnu.io.PortInUseException;
import gnu.io.UnsupportedCommOperationException;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JOptionPane;

import dao.CityDAO;
import dao.CountryDAO;
import dao.DBException;
import dao.WeatherDAO;

import metar.MetarInfo;
import metar.MetarLogException;
import metar.MetarParseException;
import metar.MetarReader;
import model.CityModel;
import model.CountryModel;
import model.WeatherModel;

import plugins.lcdstation.gui.MainFrame;
import plugins.lcdstation.io.ExDisplay;
import plugins.lcdstation.io.WeatherFile;
import plugins.lcdstation.io.WeatherModell;

/**
 * 
 * @author Hansj�rg
 */
public class Wetterstation {

	/**
	 * @param args
	 *            the command line arguments
	 * @throws InterruptedException
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException,
			InterruptedException {

		// Initialisierung
		try {
			ExDisplay.Initialize("COM3");
			ExDisplay.SetBacklight(true);
		} catch (NoSuchPortException | PortInUseException
				| UnsupportedCommOperationException | IOException
				| InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		MainFrame frame = new MainFrame();
		frame.setVisible(true);
	}

	public static WeatherFile ImportWeatherFile(String path) {
		WeatherModell model = new WeatherModell();

		// @TODO Umprogrammieren

		return model;
	}

	public static void SendToExDisplay(String l1, String l2, String l3,
			String l4) throws IOException {
		// TODO Datenaufbereitung für Display

		/*
		 * try { WeatherModel weather = new
		 * WeatherDAO().getAktWeatherByCity("EDDS"); } catch (DBException e) {
		 * // TODO Auto-generated catch block e.printStackTrace(); }
		 */

		ExDisplay.PrintText(0, l4); // 4
		ExDisplay.PrintText(2, l2); // 1
		ExDisplay.PrintText(1, l1); // 2
		ExDisplay.PrintText(3, l3); // 3
		//SimpleDateFormat format = new SimpleDateFormat("hh:mm:ss");
		// System.out.println(format.format(new Date()));
		//ExDisplay.PrintText(3, "      " + format.format(new Date()));
	}
}
